package com.levi.servicelocatorparttern;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author shentong
 * @since 2023/1/20 16:23
 * 第一种写法，用服务定位器模式消除if else
 */
@Service
@RequiredArgsConstructor
public class Client {

    private final ParserFactory parserFactory;

    public void run(TypeEnum type) {
        parserFactory.getParser(type).parse();
    }
}
